/*
*    DivaPC ARM C source
*
*    VID.H.WinBlt - Header for Vid.C.WinBlt
*
*    12-08-94  INH  Split from VID.C.WINDRV2
*/

/* Screen pointers:

   All drawing is done to the memory sprite; in full-screen mode,
   drawing is also done to the screen directly.

   SPRITE_PTR is given an offset in bytes & returns a pointer to
   the sprite, which is always valid for reading or writing.

   SCREEN_PTR returns a pointer to the screen (in full-screen mode)
   or another copy of the sprite pointer in multitasking mode. It is
   general policy not to read from this pointer, only to copy what has
   been written to SPRITE_PTR to it.
*/

#define SCREEN_PTR(x) ((int *)(VIDS_DrawPointer+(x)))
#define SPRITE_PTR(x) ((int *)(VIDS_MemoryBlk+(x)))
extern int Blt_GetXYOffset(int X, int Y);

/* Windows demands that we should be able to generate all 256 possible
   combinations of operation between source (S), destination(D) and
   pattern (P) bits during a BitBlt. This is specified using a Raster Op
   (ROP) value. If the input bits D, S and P are either 1 or 0, then
   the value of the result is given by ROP bit [P*4 + S*2 + D]. This
   is a pain to calculate, so it's translated to a polynomial

   result = a0 + a1.D + a2.S + a3.P + a4.D.S + a5.D.P + a6.S.P + a7.D.S.P

   where the '.'s are ANDs and the '+'s are XORs. The table below gives
   a ROP-to-A-value translation. The PC side actually passes us the
   translated version, not the original ROP3 parameter.

*/

#define A_0     1
#define A_D     2
#define A_S     4
#define A_P     8
#define A_DS    16
#define A_DP    32
#define A_SP    64
#define A_DSP   128

#define SRC_PRESENT (A_S | A_DS | A_SP | A_DSP )
#define PAT_PRESENT (A_P | A_DP | A_SP | A_DSP )
#define DST_PRESENT (A_D | A_DS | A_DP | A_DSP )

typedef void (*BlitFnPtr) ( int *src, int *d1, int *d2 );

/* 'Pattern' related globals ------------------------------- */

extern int Blt_PatY;	   /* Current Y-offset into pattern, in words */
extern int Blt_PatWidth;   /* Width in words */

/* Values set up by Blt_SetDestMasks ----------------------- */

extern int Blt_LHmask;     /* LH end of Blt rectangle */
extern int Blt_RHmask;     /* RH end of Blt rectangle */
extern int Blt_DstLast;    /* # of words of destination affected -1 */
extern int Blt_WordOffset; /* Offset of first dest word from start of
                               line, in words */

extern void Blt_SetDestMasks ( int X0, int X1 );

/* Blt_SetupROP & related values --------------------------- */

extern BlitFnPtr Blt_ROPfn;      /* Pointer to blit function */

extern void Blt_CopyA0 ( int *src, int *dst1, int *dst2 );
extern void Blt_CopySrc ( int *src, int *dst1, int *dst2 );
extern void Blt_SetupROP ( int opcode, int *patdata );
extern void Blt_SetupTransROP ( int opcode, int *patdata );
extern int  Blt_GetAd ( int clr, int opcode );
extern int  Blt_GetA0 ( int clr, int opcode );

/* Blt_SetDestRect & related routines ---------------------- */

extern int   Blt_DestOfs;
extern int   Blt_DestLineInc;

extern void Blt_DoLine ( int *src );
extern void Blt_SetDestRect ( RECT *pR, bool Upwards );

/* Colour-related routines --------------------------------- */

extern void Blt_MonoToColour ( BYTE *src, int *dst, int len, int fg, int bg);

/* String-blit routines ------------------------------------ */

#define ROP_TEXT_OPAQ  (A_0 | A_S)
#define ROP_TEXT_XOR   (A_S | A_D)
#define ROP_TEXT_TRANS (A_D | A_S | A_DS)

typedef void (*StrBltFnPtr) ( BYTE *src, int *dest1, int *dest2 );

extern StrBltFnPtr Blt_StrBltFn;
extern void Blt_SetupStrblt ( int opcode, int fg, int bg );

/* Blt_SetFetchRect & related routines --------------------- */

extern void Blt_FetchColour ( int *dest );
extern void Blt_FetchMono( int bg, BYTE *dst);
extern void Blt_SetFetchRect ( RECT *pR, bool Upwards, int dstX );


/* Colour-depth-related functions --------------------------- */

extern void Blt_SetBPP ( int bpp );

extern int Blt_BitsPixel;
extern int Blt_BPP_shift;
extern int Blt_PixPerWord;
extern int Blt_PPW_shift;
extern int Blt_PPW_mask;
extern int Blt_PixMask_LH;
extern int Blt_PixMask_RH;







